/*
 * hal_communication.h
 *
 *  Created on: 2025 Feb 23
 *      Author: SFLY
 */

#ifndef XTFOCLIB_HAL_DRIVERS_HAL_CAN_COMMUNICATOR_H_
#define XTFOCLIB_HAL_DRIVERS_HAL_CAN_COMMUNICATOR_H_

#include "driverlib.h"
#include "string.h"

typedef enum{
  XT_HAL_CAN_STD = 0,      //CAN2.0类型
  XT_HAL_CAN_FD = 1,       //CANFD类型
}xt_hal_cantype;//can消息类型


typedef struct{
uint32_t can_id;       //设备自身can id
uint32_t master_can_id;//主机can id
uint8_t  send_candata[64];     //发送数据帧
uint8_t  recv_candata[64];     //接收数据帧
uint8_t  temp_recv_candata[64];//临时接收数据帧
uint32_t maxDatalen;           //CAN数据最大长度
uint32_t isRecvFlag;           //判断是否接收到了本 MOTOR ID的信息
xt_hal_cantype canType;       //can消息类型
}xt_hal_can_communicator_t;


void Hal_CanCom_Init(uint32_t can_id, uint32_t master_can_id,xt_hal_cantype cantype,xt_hal_can_communicator_t *pstc);
void Hal_CanCom_RecvParse(xt_hal_can_communicator_t *pstc);
#endif /* XTFOCLIB_HAL_DRIVERS_HAL_CAN_COMMUNICATOR_H_ */
